package com.example.solrdemo.controller;

import com.example.solrdemo.entity.ZhongRuan;
import com.example.solrdemo.mapper.ZhongRuanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping(value = "/demo")
public class DemoController {
    @Autowired
    private ZhongRuanMapper zhongRuanMapper;
    @RequestMapping("/index")
    public String index(){
        return "demo";
    }

    @RequestMapping("/query/{zr}")
    @ResponseBody
    public  List<ZhongRuan> queryZhongRuan(@PathVariable(value = "zr") String zr){
        List<ZhongRuan> zhongRuan = zhongRuanMapper.queryByZr(zr);
        return zhongRuan;
    }

}
